package com.ruoyi.system.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.enums.DataSourceType;
import com.ruoyi.system.domain.OtherAbsenceRecord;
import com.ruoyi.system.domain.OtherBlocketRecord;
import com.ruoyi.system.domain.OtherMicSlotClaim;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.HashMap;
import java.util.List;

@DataSource(value = DataSourceType.SLAVE)
public interface OtherAbsenceRecordMapper extends BaseMapper<OtherAbsenceRecord> {

    @Select("select wxid ,displayName, COUNT(*)  as operationcount from AbsenceRecord where roomID=  #{roomId}  and DATE(roundStartTime) BETWEEN #{startDate} AND #{endDate}  AND TIME(roundStartTime) BETWEEN #{startTime} AND #{endTime} group by wxid,displayName")
    public List<HashMap> getAbsenceRecord(@Param("roomId") String roomID, @Param("startDate") String startDate, @Param("endDate")String endDate, @Param("startTime")String startTime, @Param("endTime")String endTime);


    @Select("select * from AbsenceRecord where roomID=  #{roomId} and wxid = #{wxid}  and DATE(roundStartTime) BETWEEN #{startDate} AND #{endDate}  AND TIME(roundStartTime) BETWEEN #{startTime} AND #{endTime} ")
    public List<OtherAbsenceRecord> getAbsenceRecordByMember(@Param("roomId") String roomID, @Param("wxid") String wxid,  @Param("startDate") String startDate, @Param("endDate")String endDate, @Param("startTime")String startTime, @Param("endTime")String endTime);

}
